package com.pxd.ServeDemo4;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Service
public class LanguageServe {
    public boolean checkChinese(String word){
        String match="^[\\u4e00-\\u9fa5]{2,4}$";//正则表达式
        if (!word.isEmpty()){
            return word.matches(match);
        }
        return false;
    }
}
@RestController
class truefourchinese{
    @Autowired
    LanguageServe languageServe;

    @RequestMapping("languageforchinese")
    public  boolean languageforchinese(String word) {
        System.out.println(1);
        return languageServe.checkChinese(word);
    }
}